package com.youi.service.impl;

import com.youi.dao.AddressMapper;
import com.youi.pojo.dto.AddressDto;
import com.youi.entity.Address;
import com.youi.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version 1.0
 * @Author: xxf
 * @CreateDate: 2020/10/28 20:05
 */
@Service
public class AddressServiceImpl implements AddressService {

    @Autowired
    private AddressMapper addressMapper;

//    public void setAddressMapper(AddressMapper addressMapper) {
//        this.addressMapper = addressMapper;
//    }

    /**
     * 根据用户ID查询地址信息
     * @param uId
     * @return
     */
    @Override
    public List<Address> selectByUId(String uId) {
        return addressMapper.selectByUId(Integer.parseInt(uId));
    }

    /**
     * 添加用户地址信息
     * @param addressDto
     * @return
     */
    @Override
    public int insert(AddressDto addressDto) {
        return addressMapper.insert(addressDto);
    }
}
